<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.Xsl" %>

<Script runat="server">
Public Sub Page_Load(sender As Object, e As EventArgs)
  Dim dom As XmlDocument
  Dim xsl As New XslTransform()

  ' Do we have the Wrox Pro ASP.NET book in the Cache?
  If (IsNothing(Cache("1861004885.xml"))) Then
    CacheStatus.Text = "Item not present, updating the Cache..."
    UpdateCache("1861004885.xml")
  Else
    CacheStatus.Text = "Retrieving from Cache"
  End If

  ' Load the transform
  xsl.Load(Server.MapPath("book.xsl"))

  dom = CType(Cache("1861004885.xml"), XmlDocument)

  BookDisplay.Document = dom
  BookDisplay.Transform = xsl

End Sub

Public Sub UpdateCache(strItem As String)

    Dim strPath As String
    Dim dom As New XmlDocument()

    ' Determine the file path the the file to monitor
    strPath = Server.MapPath(strItem)

    ' Load the file into an Xml Dom
    dom.Load(strPath)

    ' Create a CacheDependency on the file
    Dim dependency as new CacheDependency(strPath)

    ' Cache the XML document
    Cache.Insert(strItem, dom, dependency)

End Sub
</Script>
Status: <asp:label id="CacheStatus" runat=server/>
<br>
<asp:xml id="BookDisplay" runat=server/>
